<template>
   <el-row class="tac">
    <el-col>
      <h5 class="mb-2">Default colors</h5>
      <el-menu
        default-active="2"
        class="el-menu-vertical-demo"
        @open="handleOpen"
        @close="handleClose"
        :default-openeds="['1-1']"
      >
        <el-menu-item index="0">
          <el-icon><icon-menu /></el-icon>
          <span>首页</span>
        </el-menu-item>
        <el-sub-menu index="1-1">
          <template #title>
            <el-icon><location /></el-icon>
            <span>系统设置</span>
          </template>
          <el-menu-item index="1-1" @click="()=>{console.log('test')}">
            模块管理
          </el-menu-item>
          <el-menu-item index="1-2">item two</el-menu-item>
        </el-sub-menu>
        <el-sub-menu index="2">
          <template #title>
            <el-icon><icon-menu /></el-icon>
            <span>Navigator Two</span>
          </template>
          <el-menu-item index="2-1">Nested item one</el-menu-item>
          <el-menu-item index="2-2">Nested item two</el-menu-item>
        </el-sub-menu>
        <el-menu-item index="3" disabled>
          <el-icon><document /></el-icon>
          <span>Navigator Three</span>
        </el-menu-item>
        <el-menu-item index="4">
          <el-icon><setting /></el-icon>
          <span>Navigator Four</span>
        </el-menu-item>
      </el-menu>
    </el-col>
</el-row>
  </template>
  
  <script lang="ts" setup>
  import {
    Document,
    Menu as IconMenu,
    Location,
    Setting,
  } from '@element-plus/icons-vue'
  import {reactive, onMounted} from 'vue'
// const obj = reactive()
const openArray = reactive(['1'])
  onMounted(() => {
    openArray.push('1');
    console.log(openArray);
  })
  const handleOpen = (key: string, keyPath: string[]) => {
    console.log(key, keyPath)
  }
  const handleClose = (key: string, keyPath: string[]) => {
    console.log(key, keyPath)
  }
  </script>
  